package com.dayatang.android.config;

import org.json.JSONException;
import org.json.JSONObject;

import com.dayatang.android.Model.Project;
import com.dayatang.android.Model.SubProject;

public class JsonDataToProjectData {
	
	public static Project getProject(JSONObject jsonObject) throws JSONException { 
		
	    Project project = new Project();
	    project.setProjectId(jsonObject.getString("id"));
	    project.setName(jsonObject.getString("projName"));
	    project.setStatus(jsonObject.getString("status"));
	    project.setStartDate(jsonObject.getString("startDate"));
	    project.setFinishDate(jsonObject.getString("finishDate"));
	    project.setProjectType(jsonObject.getString("projectType"));
	    project.setArea(jsonObject.getString("area"));
	    project.setResponsibleDivision(jsonObject.getString("responsibleDivision"));
	    project.setBudget(jsonObject.getString("budget"));
	    project.setOutput(jsonObject.getString("output"));
	    project.setExpenditure(jsonObject.getString("expenditure"));
	    project.setReceipt(jsonObject.getString("receipt"));
	    project.setOwnerInfo(jsonObject.getString("ownerInfo"));
	    project.setSupervisorInfo(jsonObject.getString("supervisorInfo"));
	    project.setDesignerInfo(jsonObject.getString("designerInfo"));
	    project.setContractNumber(jsonObject.getString("contractNumber"));
	    project.setSubProjectNum(jsonObject.getString("subProjectNum"));
	    project.setSubProjectFinishedNum(jsonObject.getString("subProjectFinishedNum"));
	    project.setSubProjectNoFinishedNum(jsonObject.getString("subProjectNoFinishedNum"));
	    project.setWorkItemQuantity(jsonObject.getString("workItemQuantity"));
	    project.setSpecialtyOutput(jsonObject.getString("specialtyOutput"));

	    return project;
	}
	
	public static SubProject getSubProject(JSONObject jsonObject) throws JSONException { 
		
	    SubProject subProject = new SubProject();
	    subProject.setSubprojectid(jsonObject.getString("id"));
	    subProject.setName(jsonObject.getString("projName"));
	    subProject.setStartDate(jsonObject.getString("startDate"));
	    subProject.setFinishDate(jsonObject.getString("finishDate"));
	    subProject.setProjectType(jsonObject.getString("projectType"));
	    subProject.setArea(jsonObject.getString("area"));
	    subProject.setResponsibleDivision(jsonObject.getString("responsibleDivision"));
	    subProject.setBudget(jsonObject.getString("budget"));
	    subProject.setOutput(jsonObject.getString("output"));
	    subProject.setOwnerInfo(jsonObject.getString("ownerInfo"));
	    subProject.setSupervisorInfo(jsonObject.getString("supervisorInfo"));
	    subProject.setDesignerInfo(jsonObject.getString("designerInfo"));
	    subProject.setApType(jsonObject.getString("apType"));
	    subProject.setDelistCode(jsonObject.getString("delistCode"));
	    subProject.setDelistingEntrustType(jsonObject.getString("delistingEntrustType"));
	    subProject.setAddress(jsonObject.getString("address"));
	   	subProject.setOpticalCableFinishDate(jsonObject.getString("opticalCableFinishDate"));
	   	subProject.setTransmissionOpenDate(jsonObject.getString("transmissionOpenDate"));
	   	subProject.setFocus(jsonObject.getString("focus"));
	   	subProject.setProgressInfo(jsonObject.getString("progressInfo"));

	    return subProject;
	}

	
}
